import Vue from 'vue'
import VueRouter from 'vue-router'
import index from '../views/index.vue'


Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'index',
    component: index
  },
  {
    path: '/register',
    name: 'register',
    component: () => import('../views/register.vue')
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/login.vue')
  },
  {
    path: '/broadcast',
    name: 'broadcast',
    component: () => import('../views/broadcast.vue')
  },
  {
    path: '/allsinger',
    name: 'AllSinger',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/allsinger.vue'),
  },
  {
    path: '/songdail',
    name: 'Songdail',
    component: () => import("../views/songdail.vue")
  },
  {
    path: '/singer',
    name: 'Singer',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/singer.vue')
  },
  {
    path: '/search',
    name: 'Search',
    component: () => import('../views/Search.vue'),
  },
  {
    path: '/audioplayer',
    name: 'Audioplayer',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/Audioplayer.vue')
  },
{
    path:"/portal",
    name:"Portal",
    component:()=>import('../components/Portal.vue'),
    
  },
  {
    path:"/buy",
    name:"Buy",
    component:()=>import('../components/Buy.vue'),
  },
  {
    path:"/mycreate",
    name:"Mycreate",
    component:()=>import('../components/Mycreate.vue'),
  },
]
let originPush = VueRouter.prototype.push;
VueRouter.prototype.push = function(path){
  return originPush.call(this,path).catch(()=>{})
}
const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
